<?php

/**
 * History filter form.
 *
 * @package    raidpoints
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class HistoryFormFilter extends BaseHistoryFormFilter
{
    public function configure()
    {
        $this->removeWidgets();
        sfProjectConfiguration::getActive()->loadHelpers('Url');
        $this->widgetSchema['actiondate'] = new sfWidgetFormFilterDate(array(
            'from_date' => new sfWidgetFormJQueryDate(),
            'to_date' => new sfWidgetFormJQueryDate(),
            'with_empty' => false
        ));
        $this->widgetSchema['dt'] = new sfWidgetFormFilterDate(array(
            'from_date' => new sfWidgetFormJQueryDate(),
            'to_date' => new sfWidgetFormJQueryDate(),
            'with_empty' => false
        ));
        $this->widgetSchema['scheduled_date'] = new sfWidgetFormFilterDate(array(
            'from_date' => new sfWidgetFormJQueryDate(),
            'to_date' => new sfWidgetFormJQueryDate(),
            'with_empty' => false
        ));

        $this->widgetSchema['aaction'] = new sfWidgetFormDoctrineChoice(array(
            'model' => $this->getRelatedModelName('AAction'),
            'expanded' => false,
            'multiple' => false,
            'add_empty' => true,
        ));
        $this->widgetSchema['ttype'] = new sfWidgetFormDoctrineChoice(array(
            'model' => $this->getRelatedModelName('TType'),
            'expanded' => false,
            'multiple' => false,
            'add_empty' => true,
        ));
        $this->widgetSchema['playerid'] = new sfWidgetFormDoctrineJQueryAutocompleter(array(
            'model' => $this->getRelatedModelName('Player'),
            'url' => url_for("ajax/player"),
        ));
        $this->widgetSchema['raidid'] = new sfWidgetFormDoctrineJQueryAutocompleter(array(
            'model' => $this->getRelatedModelName('Raid'),
            'url' => url_for("ajax/raid"),
        ));
        $this->widgetSchema['reasonid'] = new sfWidgetFormDoctrineJQueryAutocompleter(array(
            'model' => $this->getRelatedModelName('Reason'),
            'url' => url_for("ajax/reason"),
        ));
//        $this->widgetSchema['playerid'] = new sfWidgetFormFilterInput();
//        $this->validatorSchema['playerid'] = new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false)));
//        $this->widgetSchema['reasonid'] = new sfWidgetFormFilterInput();
//        $this->validatorSchema['reasonid'] = new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false)));
    }

    public function removeWidgets()
    {
        unset($this['savedate'], $this['logdate'], $this['logcomment'], $this['comment'], $this['zoneid'], $this['created_by'], $this['updated_by'], $this['itemid']);
    }
}
